<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box1 {
            width: 300px;
            height: 300px;
            border: solid 1px;
        }
    </style>
</head>

<body>
    <div class="box1"></div>
    <SCript>
        function color() {
            const r = Math.floor(Math.random() * 256)
            const g = Math.floor(Math.random() * 256)
            const b = Math.floor(Math.random() * 256)
            return `rgb(${r},${g},${b})`;
        }
        const box = document.querySelector('div')
        box.style.backgroundColor = color()


    </SCript>
</body>

</html>